define(['jquery'], function ($) {
    //var purchaseindex = "/cpu-dashboard-fe/index.html#purchase";
    //var supplyindex = "#pages/home/supplyhome";
    var index = "#pages/home/home";
    var pathMaps = null;

    function breadcrumb123() {
    	pathMaps = {
    		//系统管理员列表界面
    		"pages/super/manager":[
    			{name:"首页",link:index},
    			{name:"系统管理员"}
    		],
    		//系统管理员编辑界面
    		"pages/super/manageredit":[
    			{name:"首页",link:index},
    			{name:"系统管理员",link:"#/pages/super/manager"},
    			{name:"管理员编辑"}
    		],
    		//路由映射配置
    		"pages/super/menurender":[
    			{name:"首页",link:index},
    			{name:"路由映射配置"}
    		]
    	};
        /*pathMaps = {
            // 平台企业资质管理
            "pages/aptitude/index": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: '企业资质管理'},
            ],
            // 供应链金融
            // 核心企业融资管理
            "pages/su_chain_finance/core_finance": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: '核心企业融资管理'},
            ],
            // 供应商融资管理
            "pages/su_chain_finance/su_finance": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: '供应商融资管理'},
            ],
            // 应收账款
            "pages/su_chain_finance/finance_list": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: '应收账款'},
            ],
            //	***********purchase**************
            //采购需求
            "requirement/requirelist/0": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("org-demand")}
            ],
            "requirement/requirelist/1": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("org-demand")}
            ],
            "pages/requirement/requirelist": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("inquiry-management"), link: "#/pages/buyoffer/buyofferlist"},
                {name: window.i18next.t("inquiry-release")}
            ],
            //询价单管理：
            "pages/buyoffer/buyofferlist": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("inquiry-management")}
            ],
            //920询价单管理：
            "pages/buyoffer/buyofferlist_new": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("inquiry-management")}
            ],
            "pages/buyoffer/buyofferedit": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("inquiry-management"), link: "#/pages/buyoffer/buyofferlist"},
                {name: window.i18next.t("inquiry-edit")}
            ],
            "pages/buyoffer/resourcing": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("inquiry-management"), link: "#/pages/buyoffer/buyofferlist"},
                {name: window.i18next.t("inquiry-release")}
            ],
            "pages/pricedecision/addcompare": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("inquiry-management"), link: "#/pages/buyoffer/buyofferlist"},
                {name: window.i18next.t("cali-infor")}
            ],
            "pages/pricecompare/pricecompare_new": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("inquiry-management"), link: "#/pages/buyoffer/buyofferlist_new"},
                {name: '比价'}
            ],
            "pages/pricedecision/pricedecision_new": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("inquiry-management"), link: "#/pages/buyoffer/buyofferlist_new"},
                {name: window.i18next.t("cali-details")}
            ],
            "pages/pricedecision/pricedecision": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("inquiry-management"), link: "#/pages/buyoffer/buyofferlist"},
                {name: window.i18next.t("cali-details")}
            ],
            "pages/pricedecision/pdresultlist": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("cali-title")}
            ],
            //920 定标详细
            "pages/pricedecision/pdresultlist_new": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("cali-title")}
            ],
            "pages/pricedecision/pdresultlist&id": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("cali-title"), link: "#/pages/pricedecision/pdresultlist"},
                {name: window.i18next.t("cali-details")}
            ],
            "pages/pricedecision/pricecompare": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("inquiry-management"), link: "#/pages/buyoffer/buyofferlist"},
                {name: window.i18next.t("cali-infor"), link: "#/pages/pricedecision/addcompare"},
                {name: window.i18next.t("comparative-price")}
            ],
            "pages/buyoffer/publictalks": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("inquiry-management"), link: "#/pages/buyoffer/buyofferlist"},
                {name: window.i18next.t("initiate-negotiation")}
            ],
            "pages/buyoffer/publictalksdetail": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("inquiry-management"), link: "#/pages/buyoffer/buyofferlist"},
                {name: window.i18next.t("negotiation-detail")}
            ],
            //采购订单：
            "pages/order/purorder": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("purchase-order")}
            ],
            "pages/order/addpurorder": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("purchase-order"), link: "#/pages/order/purorder"},
                {name: "新增采购订单"}
            ],
            "pages/order/puorderexec": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("order-query")}
            ],
            "pages/order/puorderexecdetail": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("order-query"), link: "#/pages/order/puorderexec"},
                {name: window.i18next.t("order-infor")}
            ],
            "pages/order/purOrderDetail": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("purchase-order"), link: "#/pages/order/purorder"},
                {name: window.i18next.t("order-detail")}
            ],
            "pages/order/purRefuseList": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("purchase-order"), link: "#/pages/order/purorder"},
                {name: "被拒绝订单"}
            ],
            //到货订单：
            "pages/arriveorder/arriveorderlist": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("purchase-order")}
            ],
            //1688消息处理：
            "pages/requirement/msgpush": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("message-proces")}
            ],
            //采购协同：
            "pages/checkbiz/pu_checkbill_list": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("pro-reconcilia")}
            ],
            "pages/checkbiz/pu_checkbill_card": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("pro-reconcilia"), link: "#/pages/checkbiz/pu_checkbill_list"},
                {name: window.i18next.t("recon-infor")}
            ],
            "pages/checkbiz/pu_invoice_list": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("purchase-invoice")},
            ],

            //********************(supply)**********************************
            "pages/home/newestprojectmore": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("public-infor")}
            ],
            //报价单：
            "pages/price/quotation": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("quotation")}
            ],
            "pages/price/buyOfferDetail": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("quotation"), link: "#/pages/price/quotation"},
                {name: window.i18next.t("cali-infor")}
            ],

            "pages/price/quotationOfferDetail": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("quotation"), link: "#/pages/price/quotation"},
                {name: window.i18next.t("quot-detail")}
            ],

            "pages/price/priceDetail": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("quotation"), link: "#/pages/price/quotation"},
                {name: window.i18next.t("quot-detail")}
            ],
            //允销管理:
            "pages/allowsale/applylist": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("permit-application")}
            ],
            "pages/allowsale/applyedit": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("permit-application"), link: "#/pages/allowsale/applylist"},
                {name: window.i18next.t("permit-appliinfor")}
            ],
            "pages/allowsale/applycategory": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("permit-catalog")}
            ],
            //销售订单管理：
            "pages/saleorder/saleorderlist": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("sale-order")}
            ],
            "pages/saleorder/erpsaledetail": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("sale-order"), link: "#/pages/saleorder/saleorderlist"},
                {name: window.i18next.t("sale-order-detail")}
            ],

            "pages/saleorder/saledetail": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("sale-order"), link: "#/pages/saleorder/saleorderlist"},
                {name: window.i18next.t("sale-order-detail")}
            ],
            "pages/deliveryorder/new_deliveryorder": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("sale-order"), link: "#/pages/saleorder/saleorderlist"},
                {name: window.i18next.t("new-invoice")}
            ],
            "pages/saleorder/saledetailconfirm": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("sale-order"), link: "#/pages/saleorder/saleorderlist"},
                {name: window.i18next.t("sale-order-maintenance")}
            ],
            "pages/saleorder/sale_order_detail": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("sale-order"), link: "#/pages/saleorder/saleorderlist"},
                {name: window.i18next.t("Sale-order-edit")}
            ],

            //发货管理：
            "pages/deliveryorder/deliveryorderlist": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("delive-manage")}
            ],
            "pages/deliveryorder/new_deliveryorder_so": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("delive-manage"), link: "#/pages/deliveryorder/deliveryorderlist"},
                {name: window.i18next.t("new-invoice-list")}
            ],
            "pages/deliveryorder/new_deliveryorder_so/toDeliveryOrder": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("delive-manage"), link: "#/pages/deliveryorder/deliveryorderlist"},
                {name: window.i18next.t("new-invoice-list"), link: "#/pages/deliveryorder/new_deliveryorder_so"},
                {name: window.i18next.t("new-invoice")}
            ],

            //入库单列表：
            "pages/coopbiz_billquery/purchaseinlist": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("sale-warehous")}
            ],
            //采购发票查询：
            "pages/coopbiz_billquery/invoicelist": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("invoice-list")}
            ],
            "pages/coopbiz_billquery/invoicelist&invoicebilldetail": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("invoice-list"), link: "#/pages/coopbiz_billquery/invoicelist"},
                {name: window.i18next.t("invoice-infor")}
            ],


            //商品管理
            "pages/product_manager/productlist": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("comm-manage")}
            ],
            "pages/product_manager/productpublish": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("comm-manage"), link: "#/pages/product_manager/productlist"},
                {name: window.i18next.t("choose-goods")}
            ],
            "pages/product_manager/publishdetail": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("comm-manage"), link: "#/pages/product_manager/productlist"},
                {name: window.i18next.t("choose-goods"), link: "#/pages/product_manager/productpublish"},
                {name: window.i18next.t("edit-product")}
            ],
            "pages/product_manager/productviewinfo": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("comm-manage"), link: "#/pages/product_manager/productlist"},
                {name: window.i18next.t("comm-detail")}
            ],
            "pages/product_manager/productedit": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("comm-manage"), link: "#/pages/product_manager/productlist"},
                {name: window.i18next.t("comm-modifica")}
            ],

            //销售协同：
            "pages/checkbiz/sale_checkbill_list": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("sale-recon")}
            ],
            "pages/checkbiz/sale_checkbill_card": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("sale-recon"), link: "#/pages/checkbiz/sale_checkbill_list"},
                {name: window.i18next.t("appy-recon")}
            ],
            "pages/checkbiz/sale_invoice_list": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("sale-manage")},
            ],
            "pages/checkbiz/sale_invoice_card": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("sale-manage"), link: "#/pages/checkbiz/sale_invoice_list"},
                {name: window.i18next.t("draw-bill")}
            ],
            "pages/checkbiz/sale_invoice_card_detail1": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("sale-manage"), link: "#/pages/checkbiz/sale_invoice_list"},
                {name: window.i18next.t("draw-bill"), link: "#/pages/checkbiz/sale_invoice_card"},
                {name: window.i18next.t("sale-infor")}
            ],
            "pages/checkbiz/sale_invoice_card_detail2": [
                {name: window.i18next.t("homepage"), link: supplyindex},
                {name: window.i18next.t("sale-manage"), link: "#/pages/checkbiz/sale_invoice_list"},
                {name: window.i18next.t("sale-infor")}
            ],


            //********************(admin)**********************************
            "pages/supplymgr/supplyapprovelist": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("supfile-requi")},
            ],
            //供应商管理
            "pages/pu_supplymgr/supplymgr": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("supplier-file")},
            ],
            "pages/pu_supplymgr/addsupply": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("supplier-file"), link: "#/pages/pu_supplymgr/supplymgr"},
                {name: window.i18next.t("add-supplier-file")},
            ],
            "pages/pu_supplymgr/supplydocdetail": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("supplier-file"), link: "#/pages/pu_supplymgr/supplymgr"},
                {name: window.i18next.t("supplier-infor")},
            ],
            "pages/pu_supplymgr/supplydocedit": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("supplier-manage"), link: "#/pages/pu_supplymgr/supplymgr"},
                {name: window.i18next.t("supplier-edit")},
            ],
            //供货目录管理
            "pages/allowsale/puallowlist": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("catalog-manage")},
            ],
            "pages/allowsale/puallowdetail": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("catalog-manage"), link: "#/pages/allowsale/puallowlist"},
                {name: window.i18next.t("detail-applica")},
            ],


            "pages/allowsale/puapplycategory": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                //		{name:window.i18next.t("catalog-manage"),link:"#/pages/allowsale/puallowlist"},
                {name: window.i18next.t("supply-catalog")},
            ],
            "pages/allowsale/goodspublish": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("goods-up-down")},
            ],
            //y用户管理
            "pages/admin_user/user": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("user-manage")},
            ],
            "pages/admin_user/useredit": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("user-manage"), link: "#/pages/admin_user/user"},
                {name: window.i18next.t("user-edit")},
            ],
            //参数管理
            "pages/parameter/index": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: '参数管理'},
            ],
            //组织管理：pages/organization_manager/organization
            "pages/organization_manager/organization": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("depart-manage")},
            ],
            //新增部门管理 pages/organization_manager/addorganization
            "pages/organization_manager/addorganization": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("org-manage"), link: "#/pages/organization_manager/organization"},
                {name: window.i18next.t("add-depa-manage")},
            ],
            //基本档案
            "pages/material_manager/materialclass": [
                {name: window.i18next.t("matManage-matmaterialclass"), link: purchaseindex},
                {name: window.i18next.t("mater-class")},
            ],
            "pages/material_manager/material": [
                {name: window.i18next.t("matManage-matmaterialclass"), link: purchaseindex},
                {name: window.i18next.t("mater-manage")},
            ],
            "pages/product_manager/productclslist": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("shop-class")},
            ],
            "pages/pu_supplymgr/supplyclass": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("supclass-manage")},
            ],
            "pages/product_manager/marketproductclslist": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("market-class-manage")},
            ],
            "pages/admin_enterprise/enterprisemanage": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("con-infor-manage")},
            ],
            "pages/admin_enterprise/enterprisemanageedit": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("con-infor-manage"), link: "#/pages/admin_enterprise/enterprisemanage"},
                {name: window.i18next.t("con-infor-edit")},
            ],
            "pages/admin/erpconfig": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("ERP-data-main")},
            ],
            "pages/admin/erpMaterialAys": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("ERP-data-main"), link: "#/pages/admin/erpconfig"},
                {name: window.i18next.t("syn-mate-data")},
            ],
            "pages/admin/erpSuppAys": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("ERP-data-main"), link: "#/pages/admin/erpconfig"},
                {name: window.i18next.t("syn-sup-data")},
            ],
            "pages/admin/erpconfigedit": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("ERP-data-main"), link: "#/pages/admin/erpconfig"},
                {name: window.i18next.t("ERP-data-edit")},
            ],
            //云审用户同步
            "pages/uapprove/synchronize": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("cloud-syn")},
            ],
            //审批流设计
            "pages/uapprove/processlist": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("appr-design")},
            ],
            "pages/uapprove/processdesign": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("appr-design"), link: "#/pages/uapprove/processlist"},
                {name: window.i18next.t("appr-edit")},
            ],
            "pages/bidpriceanalysis/bidpriceanalysis": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: window.i18next.t("bidprice-analysis")},
            ],
            "pages/projectprogress/index": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: '采购寻源项目看板'}
            ],
            // 执行人配置
            "operator_allocation/operator_allocation": [
                {name: window.i18next.t("homepage"), link: purchaseindex},
                {name: '业务执行人配置'},
            ],
            //库存管理
            "pages/inventory/inventorylist":[
                {name:window.i18next.t("homepage"), link: purchaseindex},
                {name:"库存管理"}
            ],
            //库存管理
            "pages/inventory/inventoryquery":[
                {name:window.i18next.t("homepage"), link: purchaseindex},
                {name:"VMI库存查看"}
            ]
        }*/

    }

    var Breadcrumb = {
        BreadcrumbNavigator: function (path, selector) {
            if (pathMaps == null) {
                breadcrumb123();
            }
            selector = selector ? selector : ".ibox-m-title";
            var reg = new RegExp("Blank=true", "g");
            var pathBlank;
            if (!path) {
                path = window.location.hash.split('#/')[1].split('?')[0];
                pathBlank = window.location.hash.split('#/')[1].split('?')[1];
            }
            if (pathBlank && reg.test(pathBlank)) {
                $(selector).html('');
            } else {
                var pathlist = pathMaps[path];
                var template = $("<div class='breadcrumb-nav'></div>");
                for (var i = 0; i < pathlist.length; i++) {
                    var item = pathlist[i];
                    if (item.link) {
                        template.append("<a href='" + item.link + "'>" + item.name + "</a>")
                    }
                    else {
                        template.append("<span>" + item.name + "</span>");
                    }
                    if (i < pathlist.length - 1) {
                        template.append("&nbsp;<i class='fa fa-angle-right'></i>&nbsp;");
                    }
                }
                $(selector).html(template);
            }
        },
    }
    return Breadcrumb

})
